import { postOrdinaryUserHttp } from '../../../request/userHttp'
export const useRegisterHttp = (formRef, form) => {
  // console.log(formRef)
  formRef.value.validate((valid) => {
    if (valid) {
      postOrdinaryUserHttp(form.username, form.password).then((response) => {
        const { code } = response.data
        if (code === 0) {
          ElMessage({
            message: '注册成功.',
            type: 'success'
          })
        }
        if (code === 1) {
          ElMessage.error('用户名已存在')
        }
      })
    }
  })
}
